package com.xinyiweidai.xinyiweidai.module.message;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.lan.mylibrary.ui.MyTitle;
import com.xinyiweidai.xinyiweidai.R;
import com.xinyiweidai.xinyiweidai.base.BaseFragment;

import java.util.ArrayList;
import java.util.List;

/**
 * classname: $CLASS_NAME$
 * Data：2018/9/20-10:46
 * Author: lanxiong
 * Description:消息fragment
 */

public class MessageFragment extends BaseFragment {


    private TabLayout tabLayout;
    private ViewPager viewPager;
    private List<Fragment> fragmentList=new ArrayList<>();


    public static MessageFragment newInstance() {
        Bundle args = new Bundle();
        MessageFragment fragment = new MessageFragment();
        fragment.setArguments(args);
        return fragment;
    }


    @Override
    protected int getLayoutId() {
        return R.layout.fragment_message;
    }

    @Override
    protected void initView(View view) {
        tabLayout = (TabLayout) view.findViewById(R.id.tabLayout);
        viewPager = (ViewPager) view.findViewById(R.id.viewPager);

        fragmentList.add(SystemFragment.newInstance());
        fragmentList.add(MyMessageFragment.newInstance());

        viewPager.setAdapter(new MessageAdapter(getChildFragmentManager(),fragmentList));
        viewPager.setCurrentItem(0);
        tabLayout.setupWithViewPager(viewPager);
    }


}
